﻿<EpiDashboard:GadgetBase x:Class="EpiDashboard.MeansControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:EpiDashboard="clr-namespace:EpiDashboard"
    xmlns:Controls="clr-namespace:EpiDashboard.Controls"
    Style="{DynamicResource gadgetBaseStyle}">
    <EpiDashboard:GadgetBase.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\..\ResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </EpiDashboard:GadgetBase.Resources>
    <Grid>
        <Controls:ShadowRectangle x:Name="rectangleShadow"></Controls:ShadowRectangle>
        <Border Name="borderAll" Style="{DynamicResource mainGadgetBorder}" >
            <Border.ContextMenu>
                <ContextMenu x:Name="gadgetContextMenu">
                    <MenuItem x:Name="mnuCopy" Header="Copy data to clipboard"/>
                    <MenuItem x:Name="mnuSendDataToHTML" Header="Send data to web browser">
                        <MenuItem.Icon>
                            <Image Source="../../Images/saveHTML.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem x:Name="mnuSendDataToExcel" Header="Send data to Excel" />
                    <Separator/>
                    <MenuItem x:Name="mnuSendToBack" Header="Send gadget to back"/>
                    <MenuItem x:Name="mnuClose" Header="Close this gadget"/>
                </ContextMenu>
            </Border.ContextMenu>

            <Grid x:Name="grdMain">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="0" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="0" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="0" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>                
                
                <Controls:GadgetHeaderPanel x:Name="headerPanel" IsFilterButtonAvailable="False" IsDescriptionButtonAvailable="False" Grid.Row="0" Text="Means" />
                <Controls:GadgetMessagePanel Margin="4" x:Name="messagePanel" Grid.Row="2" Text="" />
                <Controls:GadgetDescriptionPanel Grid.Row="4" PanelMode="Collapsed" x:Name="descriptionPanel"></Controls:GadgetDescriptionPanel>

                <!--<TextBlock Grid.Row="6" x:Name="txtFilterString" Style="{DynamicResource filterStringText}" Visibility="Collapsed" >
                </TextBlock>-->

                <Controls:GadgetInfoPanel Grid.Row="6" Visibility="Collapsed" Margin="4" x:Name="infoPanel"></Controls:GadgetInfoPanel>

                <StackPanel Grid.Row="7" x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top"></StackPanel>

                <Controls:GadgetWaitPanel x:Name="waitPanel" Visibility="Collapsed" Grid.Row="1" Grid.RowSpan="6" Style="{DynamicResource gadgetWaitPanelStyle}" />

                <StackPanel Grid.Row="1" Grid.RowSpan="9" Margin="00,-15,-10,0"  HorizontalAlignment="Right" VerticalAlignment="Top" Visibility="Collapsed">
                    <Grid x:Name="ConfigGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,10,0" >
                        <Rectangle Style="{DynamicResource rectangleConfigOuter}" />
                        <Rectangle Style="{DynamicResource rectangleConfigInner}" />

                        <Path x:Name="pathTriangle" 
                              Margin="0,-2,90,0"
                              Data="M 5 0 L 10 10 0 10 Z" Fill="{DynamicResource gadgetBackgroundBrush}" IsHitTestVisible="False" HorizontalAlignment="Right" VerticalAlignment="Top" Height="7" />
                        
                        <StackPanel Orientation="Vertical" Margin="25, 10, 25, 25" HorizontalAlignment="Center" VerticalAlignment="Top" >
                            <TextBlock x:Name="ConfigExpandedTitle" HorizontalAlignment="Center" TextAlignment="Center" Text="Means Properties" Margin="5" FontWeight="Bold" />
                            <TextBlock x:Name="tblockMainVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Means of:" Margin="0,5,0,0"  />
                            <ComboBox x:Name="cbxField" Width="150" HorizontalAlignment="Left" SelectedIndex="0" />

                            <Grid x:Name="grdAdvancedOptionsHeading">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>


                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <Expander Margin="0, 5, 0, 0" x:Name="expanderAdvancedOptions" Header="Advanced options" Expanded="expanderAdvancedOptions_Expanded">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition></ColumnDefinition>
                                            <ColumnDefinition Width="15"></ColumnDefinition>
                                            <ColumnDefinition></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <StackPanel x:Name="panelAdvanced1" Grid.Column="0">

                                            <TextBlock x:Name="tblockWeightVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Weight:" Margin="0,5,0,0"  />
                                            <ComboBox x:Name="cbxFieldWeight" HorizontalAlignment="Stretch" SelectedIndex="0" />
                                            <TextBlock x:Name="tblockStrataVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Stratify by:" Margin="0,5,0,0"  />
                                            <ListBox x:Name="lbxFieldStrata" Width="180" Height="120" SelectionMode="Extended" HorizontalAlignment="Left" />
                                            <!--<ComboBox x:Name="cbxFieldStrata" HorizontalAlignment="Stretch" SelectedIndex="0" />-->

                                            <TextBlock x:Name="tblockCrosstabVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Cross-tabulate by:" Margin="0,5,0,0"  />
                                            <ComboBox x:Name="cbxFieldCrosstab" HorizontalAlignment="Stretch" SelectedIndex="0" />                                            

                                            <CheckBox x:Name="checkboxShowANOVA" Content="Display ANOVA statistics" IsChecked="True" Margin="0,8,0,0" />

                                        </StackPanel>                                        
                                    </Grid>
                                </Expander>

                                <Expander Margin="0, 5, 0, 0" Grid.Row="1" x:Name="expanderDisplayOptions" Header="Display options">
                                    <StackPanel x:Name="panelAdvanced2" Grid.Column="2">

                                        <TextBlock x:Name="tblockPrecision" HorizontalAlignment="Left" TextAlignment="Center" Text="Decimals to display:" Margin="0,5,0,0"  />
                                        <ComboBox x:Name="cbxFieldPrecision" HorizontalAlignment="Left" Width="45" SelectedIndex="5">
                                            <ComboBoxItem>0</ComboBoxItem>
                                            <ComboBoxItem>1</ComboBoxItem>
                                            <ComboBoxItem>2</ComboBoxItem>
                                            <ComboBoxItem>3</ComboBoxItem>
                                            <ComboBoxItem>4</ComboBoxItem>
                                        </ComboBox>

                                        <TextBlock x:Name="tblockOutputColumns" Margin="0,5,0,0" >Output columns to display:</TextBlock>
                                        <ListBox x:Name="lbxColumns" SelectionMode="Multiple" SelectionChanged="lbxColumns_SelectionChanged" />

                                    </StackPanel>
                                </Expander>
                            </Grid>

                            <Button x:Name="btnRun" Content="Run" Margin="0,20,0,0" Click="btnRun_Click" />
                        </StackPanel>
                    </Grid>
                </StackPanel>                
            </Grid>
        </Border>
    </Grid>
</EpiDashboard:GadgetBase>
